package com.you.member.dal.dao;

import java.util.List;

import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;

import com.you.member.dal.dao.dataobject.MemberDO;

/**
 * @author yunpeng.jiangyp
 */
public class MemberDAO extends SqlMapClientDaoSupport {

    public MemberDO find(Long id) {
        return (MemberDO) super.getSqlMapClientTemplate().queryForObject("MS-SELECT-MEMBER-BY-PK", id);
    }

    public List<MemberDO> queryLateJoin() {
        return super.getSqlMapClientTemplate().queryForList("MS-SELECT-LATE-JOIN-MEMBER");
    }

    public MemberDO findByEmail(String email) {
        return (MemberDO) super.getSqlMapClientTemplate().queryForObject("MS-SELECT-MEMBER-BY-EMAIL", email);
    }

    public boolean update(MemberDO memberDO) {
        return getSqlMapClientTemplate().update("MS-UPDATE-MEMBER", memberDO) > 0;
    }

    public Long create(MemberDO memberDO) {

        return (Long) getSqlMapClientTemplate().insert("MS-INSERT-MEMBER", memberDO);
    }
    
    

}
